home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1998 January / PC Answers Issue 49 Cover CD January 1998.iso / Apps / Director / DATA.Z / Widget Wizard.dir / WidgtBehaviors_62_Message All Sprites.ls < prev    next >
Encoding:
Text File  |  1997-05-10  |  2.8 KB  |  96 lines

  1. property whichevent, EventToSend, DownCM, UpCM, DownNum, UpNum, button_active
  2.  
  3. on beginSprite me
  4.   set the UpCM of me to the member of sprite the spriteNum of me
  5.   set the UpNum of me to the number of member UpCM
  6.   set the DownNum of me to the number of member DownCM
  7.   set the button_active of me to 0
  8.   puppetSprite(the spriteNum of me, 1)
  9. end
  10.  
  11. on endSprite me
  12.   puppetSprite(the spriteNum of me, 0)
  13. end
  14.  
  15. on triggerSendAllSprites me
  16.   trigger(me)
  17. end
  18.  
  19. on mouseUp me
  20.   set the member of sprite the spriteNum of me to UpNum
  21.   set the button_active of me to 0
  22.   if whichevent = #mouseUp then
  23.     trigger(me)
  24.   end if
  25. end
  26.  
  27. on mouseDown me
  28.   set the member of sprite the spriteNum of me to DownNum
  29.   set the button_active of me to 1
  30.   if whichevent = #mouseDown then
  31.     trigger(me)
  32.   end if
  33. end
  34.  
  35. on mouseUpOutSide me
  36.   set the button_active of me to 0
  37. end
  38.  
  39. on mouseLeave me
  40.   if the button_active of me then
  41.     set the member of sprite the spriteNum of me to UpNum
  42.   end if
  43. end
  44.  
  45. on mouseEnter me
  46.   if the button_active of me then
  47.     set the member of sprite the spriteNum of me to DownNum
  48.   end if
  49. end
  50.  
  51. on prepareFrame me
  52.   if whichevent = #prepareFrame then
  53.     trigger(me)
  54.   end if
  55. end
  56.  
  57. on enterFrame me
  58.   if whichevent = #enterFrame then
  59.     trigger(me)
  60.   end if
  61. end
  62.  
  63. on exitFrame me
  64.   if whichevent = #exitFrame then
  65.     trigger(me)
  66.   end if
  67. end
  68.  
  69. on trigger me
  70.   sendAllSprites(the EventToSend of me)
  71. end
  72.  
  73. on getPropertyDescriptionList
  74.   set description to [:]
  75.   if the currentSpriteNum = 0 then
  76.     set memdefault to 0
  77.   else
  78.     set memref to the member of sprite the currentSpriteNum
  79.     set castLibNum to the castLibNum of memref
  80.     set memdefault to member (the memberNum of member memref + 1) of castLib castLibNum
  81.   end if
  82.   addProp(description, #DownCM, [#default: memdefault, #format: #bitmap, #comment: "Pict for Down:"])
  83.   addProp(description, #EventToSend, [#comment: "Message:", #format: #symbol, #default: #SwitchStates])
  84.   addProp(description, #whichevent, [#comment: "Triggering Event:", #format: #symbol, #range: [#mouseUp, #mouseDown, #prepareFrame, #enterFrame, #exitFrame], #default: #mouseUp])
  85.   return description
  86. end
  87.  
  88. on getBehaviorDescription
  89.   return "Send a Message to the every Sprite in the current frame when the specified Event occurs.  At each destination the message will be interpreted as a sprite event and any actions defined for that event will be invoked." & RETURN & "PARAMETERS:" & RETURN & "ΓÇó Message - name of event to invoke at each destination." & RETURN & "ΓÇó Triggering Event - event that should cause message to be sent." & RETURN & "NOTES:" & RETURN & "If the target sprite does not handle the message it will propagate to the current frame, and then the movie, in search of a handler for that event."
  90. end
  91.  
  92. on getAssocMembers
  93.   set myPropList to [DownCM]
  94.   return myPropList
  95. end
  96.